package dao;

import com.javaweb.config.SpringConfig;
import com.javaweb.dao.ArticleDao;
import com.javaweb.dao.CategoryDao;
import com.javaweb.dao.CategoryDao;
import com.javaweb.model.Article;
import com.javaweb.model.Category;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes={SpringConfig.class})
public class Categorytest
{
    @Autowired
    private CategoryDao categoryDao;
    @Test
    public void testinsert(){
        Category category = new Category().setName("a").setOrder(3).setParentId(2).setUpdateTime(new Date()).setCreateTime(new Date());
        int ret=categoryDao.insert(category);
        Assert.assertTrue(ret>0);
    }
}
